package com.zhi.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;

/**
 * 学生
 */
@Entity
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Student {

    //学生学号
    @Id
    private String studentId;

    //学生姓名
    @Column(nullable = false,unique = false)
    private String name;

    //学生证件号
    @Column(nullable = false,unique = false)
    private String idCardNo;

    //学生班级
    @Column(nullable = false)
    private String gradeId;

    //学生邮箱
    @Column(nullable = false)
    private String email;

    @JoinColumn(name = "gradeId",insertable = false, updatable = false)
    @ManyToOne(cascade = {CascadeType.ALL},fetch = FetchType.LAZY)
    private Grade grade;

}
